<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller
{

    public function _initialize()
    {
        $this->pubHead();
    }

    public function index()
    {
        //轮播商品
        $where['pid'] = 68;
        $proInfo1 = M('commodity')->where($where)->limit(1)->find();
        //dump($proInfo1);
        $this->assign('tdPro', $proInfo1);

        $where['pid'] = 69;
        $proInfo2 = M('commodity')->where($where)->limit(1)->find();
        //dump($proInfo1);
        $this->assign('tdPro2', $proInfo2);

        //首页广告图
        $where['pid']=70;
        $advImg=M('Advert')->where($where)->select();
        $this->assign('advImg',$advImg[0]);
        //热销产品
        $hotPro=M('commodity')->where('sytjpc = "1" ')->order('sort desc')->limit(8)->select();
        $this->assign('hotPro',$hotPro);
        //dump($hotPro);
        //新闻资讯
        $newsInfo=M('content')->where('cid=25')->order('createtime desc')->select();
        $this->index = 1;
        $this->assign('newsInfo',$newsInfo);



        $this->display();
    }









    public function pubHead()
    {
        //banner图  ？？？为毛不轮播？？？
        $banner = M('image')->where('cid = 0 and recommend = 1')->order('sort desc')->select();
        $num = count($banner);
        //$banne = $num == 1 ? 1 : 0;
        $banne = 1;
        $this->assign('banne',$banne);
        $this->assign('banner',$banner);

        //底部服务条目
        $claa = D('class')->findFootLinks();
        $serList = $claa['serList'];
        unset($claa['serList']);
        $this->assign('footClass',$claa);
        $this->assign('serList',$serList);
        //dump($claa);

        $serList =

        //公司信息
        $info = M('info')->find();
        //dump($info);
        $this->assign('info', $info);



    }



}